package com.daifeng.gulimall.search.controller.api;

import com.daifeng.common.to.es.SkuEsModel;
import com.daifeng.common.utils.R;
import com.daifeng.gulimall.search.services.EsprodcutSaveService;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/search")
public class putController {

    @Resource
    private EsprodcutSaveService prodcutService;

    @PostMapping("/product")
    public R  bulkIndex(@RequestBody List<SkuEsModel> esModels ) throws IOException {
        Boolean aBoolean = prodcutService.bulkIndex(esModels);
        return aBoolean?R.ok():R.error();
    }

}
